<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>
<link rel="stylesheet" href="/misc/app/css/product_list.css"/>
<link rel="stylesheet" href="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.css"/>
<#--<style type="text/css"  rel="stylesheet">-->
    <#--tr{-->
        <#--border-bottom: 2px dashed grey;-->
    <#--}-->
<#--</style>-->
</@head>

<@body>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/moment.min.js"></script>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.js"></script>
<script src="/misc/app/js/lgsBills_list.js"></script>
</@body>

<@layout_default>
<div class="box">
    <div class="box-header with-border">
        <span class="pull-right text-muted">共 ${lgsBillsList.resultTotal} 条记录</span>
        <input type="hidden" id="resultTotal_hidden" value="${lgsBillsList.resultTotal}" />
        <input type="hidden" id="cTimeS_hidden" value="${cTimeS!}" />
        <input type="hidden" id="cTimeE_hidden" value="${cTimeE!}" />
        <input type="hidden" id="node_hidden" value="${node!}" />
        <input type="hidden" id="from_hidden" value="${fromId!}" />
        <input type="hidden" id="to_hidden" value="${toId!}" />
        <input type="hidden" id="scan_hidden" value="${depotScan!}" />
        <form class="form-inline" action="/lgsBills" name="queryForm">
        	<!--查询条件 第一行 start-->
        	<div>
                <div class="input-group">
                    <div class="input-group-addon">产品名称</div>
                    <input type="text" class="form-control" style="width: 180px" name="productName" value="${productName!}" placeholder="产品名称"/>
                </div>
                <div class="input-group">
                    <div class="input-group-addon">单号</div>
                    <input type="text" class="form-control" style="width: 180px" name="billsNo" value="${billsNo!}" placeholder="单号"/>
                </div>
                <div class="input-group">
                    <div class="input-group-addon">单据类型</div>
                    <select class="form-control" name="billsType">
                        <option value="">全部</option>
                        <option value="1" ${(billsType?exists && billsType == 1)?string("selected","")}>自建</option>
                        <option value="2" ${(billsType?exists && billsType == 2)?string("selected","")}>erp抓取</option>
                        <option value="3" ${(billsType?exists && billsType == 3)?string("selected","")}>其它</option>
                    </select>
                </div>
                <div class="input-group">
                    <div class="input-group-addon">操作类型</div>
                    <select class="form-control" name="node" style="width:180px;">
                        <option value="">全部</option>
                    </select>
                </div>
                <div class="input-group">
                    <div class="input-group-addon">应扫箱数</div>
                    <input type="text" class="form-control"  id="nubsS" name="nubsS" value="${nubsS!}" size="5">
                </div>
                <div class="input-group"> - </div>
                <div class="input-group">
                    <input type="text" class="form-control"  id="nubsE" name="nubsE" value="${nubsE!}" size="5">
                </div>
                <div class="input-group">
                    <div class="input-group-addon">实扫箱数</div>
                    <input type="text" class="form-control"  id="scanNubsS" name="scanNubsS" value="${scanNubsS!}" size="5">
                </div>
                <div class="input-group"> - </div>
                <div class="input-group">
                    <input type="text" class="form-control" id="scanNubsE" name="scanNubsE" value="${scanNubsE!}" size="5">
                </div>
            </div>
            <!--查询条件 第一行 end-->
            <!--查询条件 第二行 start-->
            <div style="padding-top:5px;">
                <div class="input-group">
                    <div class="input-group-addon">扫码地点</div>
                    <select class="form-control" name="depotScan" id="depotScan" style="width:180px;">
                        <option value="">全部</option>
                    </select>
                </div>
            	<div class="input-group">
	                <div class="input-group-addon">收货对象</div>
	                <select class="form-control" name="toId"  id="toDepot" style="width:180px;">
	                    <option value="">全部</option>
	                </select>
	            </div>
            	<div class="input-group">
	                <div class="input-group-addon">发货对象</div>
	                <select class="form-control" name="fromId" id="frmDepot" style="width:180px;">
	                    <option value="">全部</option>
	                </select>
	            </div>

	            <div class="input-group">
	                <div class="input-group-addon">操作时间</div>
	                <input type="text" class="form-control" id="cTime_start" name="cTimeS" size="18">
	            </div>
	            <div class="input-group"> 至 </div>
	            <div class="input-group">
	                <input type="text" class="form-control" id="cTime_end" name="cTimeE" size="18">
	            </div>
                <div class="input-group">
                    <div class="input-group-addon">状态</div>
                    <select class="form-control" name="sta">
                        <option value="">全部</option>
                        <option value="1" ${(sta?exists && sta == 1)?string("selected","")}>初始创建</option>
                        <option value="2" ${(sta?exists && sta == 2)?string("selected","")}>使用中</option>
                        <option value="3" ${(sta?exists && sta == 3)?string("selected","")}>已完成</option>
                        <option value="4" ${(sta?exists && sta == 4)?string("selected","")}>封存</option>
                        <option value="5" ${(sta?exists && sta == 5)?string("selected","")}>已作废</option>
                    </select>
                </div>
	            
            </div>
            <!--查询条件 第二行 end-->
			<div style="padding-top:5px;">
				<button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 查询</button>
	            <button type="button" id="search_reset" class="btn btn-warning"><i class="fa"></i> 重置</button>
	            <button type="button" class="btn btn-default" name="btn_new_bill"><i class="fa fa-plus"></i> 创建单据</button>
			</div>
            
        </form>
        
    </div>

    <!-- /.box-header -->
    <div class="box-body">
        <table class="table table-striped table-hover">
            <tr>
                <th>ID</th>
                <th>单号</th>
                <th style="width:200px;">产品名称</th>
                <th>操作类型</th>
                <th>单据类型</th>
                <th>应扫箱数</th>
                <th>实扫箱数</th>
                <th>扫码地点</th>
                <th>收货对象</th>
                <th>发货对象</th>
                <th>操作时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            <#if (lgsBillsList.result?size > 0)>
                <#list lgsBillsList.result as item>
                    <tr>
                        <td style="vertical-align:middle;">${item.id!}</td>
                        <td style="vertical-align:middle;">${item.billsNo!}</td>
                        <td style="vertical-align:middle;">
                             <#list item.billsProductList as pro>
                                ${pro.productName!}
                                 <#if pro_index?if_exists+1 != item.billsProductList?size><hr></#if>
                             </#list>
                        </td>
                        <td style="vertical-align:middle;">${item.nodeName!}</td>
                        <td style="vertical-align:middle;">
                            <#if item.type?exists>
                                <#if item.type == 1>自建</#if>
                                <#if item.type == 2>erp抓取</#if>
                                <#if item.type == 3>其它</#if>
                            </#if>
                        </td>
                        <td style="vertical-align:middle;"> <#--应扫瓶数-->
                            <#list item.billsProductList as pro1>
                                ${pro1.nubs!}
                                <#if pro1_index?if_exists+1 != item.billsProductList?size><hr></#if>
                            </#list>
                        </td>
                        <td style="vertical-align:middle;">
                            <#list item.billsProductList as pro1>
                                <#if pro1.scanNubs??>
                                    ${pro1.scanNubs!}
                                <#else>
                                    &nbsp;
                                </#if>
                                <#if pro1_index?if_exists+1 != item.billsProductList?size><hr></#if>
                            </#list>
                        </td>
                        <td style="vertical-align:middle;">${item.depotScanName!}</td>
                        <td style="vertical-align:middle;">${item.to!}</td>
                        <td style="vertical-align:middle;">${item.from!}</td>
                        <td style="vertical-align:middle;">${item.cTime?number_to_datetime}</td>
                        <td style="vertical-align:middle;">
                            <#if item.sta?exists>
                                <#if item.sta == 1>初始创建</#if>
                                <#if item.sta == 2>使用中</#if>
                                <#if item.sta == 3>已完成</#if>
                                <#if item.sta == 4>封存</#if>
                                <#if item.sta == 5><span class="text-red">已作废</span></#if>
                            </#if>
                        </td>
                        <td style="vertical-align:middle;">
                            <button type="button" class="btn btn-default btn-xs" name="btn_bill_item" data-bill-id="${item.id?c}">明细</button>
                            <button type="button" class="btn btn-default btn-xs" name="btn_bill_detail" data-bill-id="${item.id?c}">查看</button>
                            <#if item.sta != 5>
                                <button type="button" class="btn btn-default btn-xs" name="btn_invalid_bill" data-bill-id="${item.id?c}">作废</button>
                            </#if>
                        </td>
                    </tr>
                </#list>
            <#else>
                <tr>
                    <td class="text-center text-muted" colspan="6"><i class="fa fa-info-circle"></i> 没有记录</td>
                </tr>
            </#if>
        </table>
        <table class="table table-striped table-hover">
        	<tr>
        		<td colspan="13" style="text-align:right;background-color:white;">
        			<a href="javascript:void(0);" name="btn_export"><i class="glyphicon glyphicon-save"></i> 数据导出</a>
        		</td>
        	</tr>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
        <@components.pagination "/lgsBills?productName=${productName!}&toId=${toId!}&fromId=${fromId!}&cTimeS=${cTimeS!}&cTimeE=${cTimeE!}&depotScan=${depotScan!}&billsNo=${billsNo!}&billsType=${billsType!}&node=${node!}&sta=${sta!}&nubsS=${nubsS!}&nubsE=${nubsE!}&scanNubsS=${scanNubsS!}&scanNubsE=${scanNubsE!}&page=$page",lgsBillsList.page,lgsBillsList.pageTotal/>
    </div>
</div>

</@layout_default>